import java.util.Scanner;

public class Main1750 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int x = 0;
        int y = 0;
        for (int i = 1; i <= n; i++) {
            int a = i / 100;
            int b = i / 10 % 10;
            int c = i % 10;
            if (a == 0) {
                if (c == 0) {
                    x++;
                }

            }else if (b == 0 || c == 0){
                y++;
            }

        }System.out.println(x+y);
    }
}
